#include "WelcomWindow.h"
#include "ui_WelcomWindow.h"
#include "User.h"
#include "CurrentUser.h"

WelcomWindow::WelcomWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::WelcomWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("KFC订餐系统");

    /**
      * @leiteorz
      * 显示的时候得把右下角的欢迎xxx加载一下
      */
    //当前用户表current_user
    CurrentUser current_user;

    User u = current_user.queryCurrentUser();
    QString str = "欢迎用户:";
    str += u.name;
    ui->welcom_user_name->setText(str);
}

WelcomWindow::~WelcomWindow()
{
    delete ui;
}

//显示欢迎界面
void WelcomWindow::replyShowWelcom(){
    this->show();

    //当前用户表current_user
    CurrentUser current_user;

    User u = current_user.queryCurrentUser();
//    qDebug()<<u.name;
    QString str = "欢迎用户:";
    str += u.name;
    ui->welcom_user_name->setText(str);
}

//跳转到个人信息界面
void WelcomWindow::on_self_inform_btn_clicked()
{
    emit showSelfInformWindow();
    this->hide();
}

//跳转到订餐界面
void WelcomWindow::on_order_food_btn_clicked()
{
    emit showOrderFoodWindow();
    this->hide();
}
